<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/public/header.jsp"%>
<%
	String gd_id = request.getParameter("gd_id") == null ? "" : request.getParameter("gd_id");
String gd_code = request.getParameter("gd_code") == null ? "" : request.getParameter("gd_code");
String gd_name = request.getParameter("gd_name") == null ? "" : request.getParameter("gd_name");
%>
<html>
	<head>
		<title>打印预览</title>
<style>
			.td1{
				padding-top:10px;
				padding-bottom:5px;
				font-size: 12px;
				background-color: #c0ebd7;
				width:20%;
			}
			.td2{
				padding:5px;
			}
			.datagrid-cell {
			  font-size: 18px;
			}
		</style>
	<script type="text/javascript">
	$(function() {
		$("#table").datagrid({
			title:"个人结算汇总",
			iconCls:'icon-zc',
			loadMsg:'正在加载数据，请稍后......',
			url:'<%=contextPath %>/springMVC/gd/listGdLoan?gd_id=<%=gd_id%>',
			rownumbers:true,
			singleSelect:true,
			showFooter:true,
			fitColumns:true,
			idField:'id',
			frozenColumns:[[
			      {title:'主键',field:'id',hidden:true}
			]],
			columns:[[
				{title:'日期',field:'operation_date',width:150,align:'center',sort:true},
				{title:'申请人',field:'person_name',width:100,align:'center'},
				{title:'放款日期',field:'actual_operation_date',width:150,align:'center',sort:true},
				{title:'借款金额',field:'money',width:100,align:'center'},
				{title:'报账金额',field:'already_money',width:100,align:'center'},
				{title:'摘要',field:'remark',width:400,align:'center'}
			]],
			pageSize:10,
			pageList : [10,50,100],  
			pagination:true,
			onLoadSuccess:function(data){
					showFooter();
			}
			});
		});
		
		function showFooter(){
			var jsondata=$("#table").datagrid("getData");
			var total2 = 0;
			for(var i=0;i<jsondata.total;i++){
				total2 += parseFloat(jsondata.rows[i].already_money);
			}
			$('#table').datagrid('reloadFooter',[
			                              	{money:'合计:',
			                              		already_money:total2
			                              	 }
			                              ]);
		}
		function startPrint(obj){
			$(obj).hide();
			window.print();
		}
	</script>
	</head>
	<body>
		<table  style="border-collapse: collapse;" width="100%" border="1px" bordercolor="#0eb83a">
				<tr>
					<td align="right" class="td1" nowrap>工单编号：</td>
					<td class="td2" nowrap>
						<span  id="gd_code" name="gd_code" ><%=gd_code%></span>
					</td>
					<td align="right" class="td1" nowrap>工单名称：</td>
					<td class="td2" nowrap>
						<span  id="gd_name" name="gd_name" ><%=gd_name%></span>
					</td>
				</tr>
				<tr>
					<td align="right" class="td1" nowrap>
					</td>
					<td class="td2" nowrap colspan='3'>
							<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-print'" onclick="startPrint(this);">确认打印</a>
					</td>
				</tr>
				<tr>
					<td class="td2" nowrap colspan='4'>
						<div id="table" ></div>
					</td>
				</tr>
				
				</table>
		
	</body>
</html>